package com.example.mobile2032021606130zlw0416;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

public class shipeqi extends RecyclerView.Adapter<shipeqi.shezi> {
    private Context context;
    private List<Wenzi>lie;

    public shipeqi(Context context, List<Wenzi> lie) {
        this.context = context;
        this.lie = lie;
    }

    @NonNull
    @Override
    public shezi onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        //要设置上下文环境，不然你以为是它懂main吗
        View view=View.inflate(context,R.layout.shipeqibuju,null);//组件套用
        return new shezi(view);
    }

    @Override
    public void onBindViewHolder(@NonNull shezi holder, int position) {
          holder.textView.setText(lie.get(position).getName());
    }

    @Override
    public int getItemCount() {
        return lie.size();
    }

    public class shezi extends RecyclerView.ViewHolder {
        private TextView textView;
        public shezi(@NonNull View itemView) {
            super(itemView);
            textView=itemView.findViewById(R.id.huode);
        }
    }
}
